Passed
Push — master ( ecb34d...b8eee1 )
by Maxence
02:13
created

admin_pico_elements.initUI   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 1
nc 1
nop 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A 0 3 1
A 0 3 1
1
/*
2
 * CMS Pico - Integration of Pico within your files to create websites.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
/** global: admin_pico_nav */
27
28
var admin_pico_elements = {
29
30
	cms_pico_curr_templates: null,
31
	cms_pico_new_template: null,
32
	cms_pico_refresh_templates: null,
33
	cms_pico_submit: null,
34
35
	init: function() {
36
		admin_pico_elements.initElements();
37
		admin_pico_elements.initUI();
38
		admin_pico_elements.initTweaks();
39
	},
40
41
42
	initElements: function () {
43
		admin_pico_elements.cms_pico_curr_templates = $('#admin_cms_pico_curr_templates');
44
		admin_pico_elements.cms_pico_new_template = $('#admin_cms_pico_new_templates');
45
		admin_pico_elements.cms_pico_refresh_templates = $('#admin_cms_pico_refresh_templates');
46
		admin_pico_elements.cms_pico_submit = $('#admin_cms_pico_add_submit');
47
	},
48
49
50
	initUI: function () {
51
		admin_pico_elements.cms_pico_refresh_templates.css('cursor', 'pointer').on('click', function () {
52
			admin_pico_nav.retrieveSettings();
53
		});
54
55
		admin_pico_elements.cms_pico_submit.on('click', function() {
56
			admin_pico_nav.addCustomTemplate();
57
		});
58
	},
59
60
	
61
	initTweaks: function () {
62
		$.fn.emptyTable = function () {
63
			this.children('tr').each(function () {
64
				if ($(this).attr('class') !== 'header') {
65
					$(this).remove();
66
				}
67
			});
68
		};
69
	}
70
};